home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / gg / ncurses-5.3.lha / ncurses-5.3 / test / firstlast.c < prev    next >
C/C++ Source or Header  |  2002-10-24  |  2KB  |  91 lines

  1. /*
  2.  * This test was written by Alexander V. Lukyanov to demonstrate difference
  3.  * between ncurses 4.1 and SVR4 curses
  4.  *
  5.  * $Id: firstlast.c,v 1.3 2001/09/15 21:46:34 tom Exp $
  6.  */
  7.  
  8. #include <test.priv.h>
  9.  
  10. static void
  11. fill(WINDOW *w, const char *str)
  12. {
  13.     const char *s;
  14.     for (;;) {
  15.     for (s = str; *s; s++) {
  16.         if (waddch(w, *s) == ERR) {
  17.         wmove(w, 0, 0);
  18.         return;
  19.         }
  20.     }
  21.     }
  22. }
  23.  
  24. int
  25. main(
  26.     int argc GCC_UNUSED,
  27.     char *argv[]GCC_UNUSED)
  28. {
  29.     WINDOW *large, *small;
  30.     initscr();
  31.     noecho();
  32.  
  33.     large = newwin(20, 60, 2, 10);
  34.     small = newwin(10, 30, 7, 25);
  35.  
  36.     /* test 1 - addch */
  37.     fill(large, "LargeWindow");
  38.  
  39.     refresh();
  40.     wrefresh(large);
  41.     wrefresh(small);
  42.  
  43.     mvwaddstr(small, 5, 5, "   Test <place to change> String   ");
  44.     wrefresh(small);
  45.     getch();
  46.  
  47.     touchwin(large);
  48.     wrefresh(large);
  49.  
  50.     mvwaddstr(small, 5, 5, "   Test <***************> String   ");
  51.     wrefresh(small);
  52.  
  53.     /* DIFFERENCE! */
  54.     getch();
  55.  
  56.     /* test 2: erase */
  57.     erase();
  58.     refresh();
  59.     getch();
  60.  
  61.     /* test 3: clrtoeol */
  62.     werase(small);
  63.     wrefresh(small);
  64.     touchwin(large);
  65.     wrefresh(large);
  66.     wmove(small, 5, 0);
  67.     waddstr(small, " clrtoeol>");
  68.     wclrtoeol(small);
  69.     wrefresh(small);
  70.  
  71.     /* DIFFERENCE! */ ;
  72.     getch();
  73.  
  74.     /* test 4: clrtobot */
  75.     werase(small);
  76.     wrefresh(small);
  77.     touchwin(large);
  78.     wrefresh(large);
  79.     wmove(small, 5, 3);
  80.     waddstr(small, " clrtobot>");
  81.     wclrtobot(small);
  82.     wrefresh(small);
  83.  
  84.     /* DIFFERENCE! */
  85.     getch();
  86.  
  87.     endwin();
  88.  
  89.     ExitProgram(EXIT_SUCCESS);
  90. }
  91.